﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using VOL.AppManager.Repositories;
using VOL.Core.Extensions;
using VOL.Core.Filters;
using VOL.Entity.DomainModels;

namespace VOL.WebApi.Controllers
{
    [Route("dbtest")]
    public class DbTestController : Controller
    {

        [HttpGet, Route("test")]
        [AllowAnonymous]
        public ActionResult Test()
        {

            ServerDBTestRepository.Instance.Add(new ServerDBTest()
            {
                ServerName = "ServerDBTest",
                CreateDate = DateTime.Now
            }, true);

            var serviceList = ServerDBTestRepository.Instance.Find(x => true);

            Console.WriteLine(serviceList.Serialize());



            ReportDBTestRepository.Instance.Add(new ReportDBTest()
            {
                ReportName = "ReportName",
                CreateDate = DateTime.Now
            }, true);

            var reportList = ServerDBTestRepository.Instance.Find(x => true);

            Console.WriteLine(serviceList.Serialize());

            return Content("1");
        }
    }
}
